import TMXarticleProvider
# TA BPO SU
if __name__ == '__main__':

    with open('TMX_stock_list.txt',"r") as f:
        ticker_list = f.read().splitlines()
    
    listoflists = []
    tmplist = []
    batch_size = 4
    
    for t in ticker_list:
        tmplist.append(t)
        if len(tmplist) > batch_size:
            listoflists.append(tmplist)
            tmplist = []    

    for s in listoflists:
        slw = TMXarticleProvider.stocks_wrapper()
        slw.stock_list = s
        slw.getArticleList()    
        slw.downloadArticles()
        x = TMXarticleProvider.articles()
        x.open_ex(x.tempDir())

    pass